from django.db import models


# Create your models here.
class Order(models.Model):
    ORDER_TYPE_CHOICES = (
        ('normal', '常规订单'),
        ('urgent', '加急订单'),
        ('special', '特殊订单'),
    )
    product_name = models.CharField(max_length=50, verbose_name='产品名称', default=None)
    name = models.CharField(max_length=20, verbose_name='订单人姓名')
    company = models.CharField(max_length=20, verbose_name='单位')
    # address = models.CharField(max_length=50, verbose_name='地址')
    province_id = models.IntegerField(verbose_name='省ID', default=None)
    city_id = models.IntegerField(verbose_name='市ID', default=None)
    district_id = models.IntegerField(verbose_name='区ID', default=None)
    phone = models.CharField(max_length=11, verbose_name='联系方式')
    order = models.CharField(max_length=20, choices=ORDER_TYPE_CHOICES, verbose_name='类型')
    special_date = models.DateField(null=True, blank=True, verbose_name='特定日期')
    remark = models.TextField(blank=True, verbose_name='备注')
    created_at = models.DateTimeField(auto_now_add=True)
    is_complete = models.IntegerField(verbose_name='订单状态', default=0)

    class Meta:
        db_table = 'orders'
        verbose_name = '订单'
        verbose_name_plural = verbose_name

    def __str__(self):
        return self.name
